package com.zr.depotarea.mapper;

import com.zr.depotarea.pojo.Depotarea;
import com.zr.depotarea.pojo.DepotareaSelectVo;
import com.zr.depotarea.pojo.DepotareaUpdateVo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import javax.validation.constraints.NotBlank;
import java.util.List;

/**
 * Created by star on 2019/7/16.
 */
@Mapper
public interface DepotareaMapper {


    List<Depotarea> queryPage(DepotareaSelectVo depotareaSelectVo);
    int queryCount(DepotareaSelectVo depotareaSelectVo);

    @Select("select * from depotarea where areacode = #{areacode}")
    List<Depotarea> queryByCode(String areacode);
    @Select("select * from depotarea where Areaname = #{Areaname}")
    List<Depotarea> queryByName(String areaname);
    //TODO 新增
    @Insert("insert into depotarea (areacode,Areaname,arearemark,areaStatus) values (#{areacode},#{Areaname},#{arearemark},#{areaStatus}) ")
    int addDepotarea(Depotarea depotarea);

    @Update("update depotarea set Areaname=#{Areaname},arearemark=#{arearemark} where id = #{id}")
    int updateDepotarea(Depotarea depotarea);
    @Select("select * from depotarea where Areaname =#{Areaname} and  id!=#{id}")
    List<Depotarea> queryByAll(DepotareaUpdateVo depotareaUpdateVo);

    @Select("select * from depotarea where id=#{id}")
    List<Depotarea> queryById(Integer id);

    @Update("update depotarea set areaStatus=#{areaStatus} where id=#{id}")
    int updateStatus(Depotarea depotarea);
}
